package com.killers.cold.orm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.killers.cold.orm.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;


/**
 * JsonInclude.Include.NON_NULL 表示转化为json时，自动过滤掉为空的字段
 * @author 罗天豪
 * @date 2019/9/4
 */
@TableName("ck_file")
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper=false)
public class FileInformation extends BaseEntity {

    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    @TableField
    @ApiModelProperty("文件唯一标志")
    @NotEmpty(message = "文件标志为空")
    @Length(min = 1,max = 50)
    private String fileId;

    @TableField
    @ApiModelProperty("文件原始名称")
    @NotEmpty(message = "文件原始名称不为空")
    @Length(min = 1,max = 50)
    private String fileOriginalName;

    @TableField
    @ApiModelProperty("文件路径")
    @NotEmpty(message = "文件路径不为空")
    @Length(min = 1,max = 200)
    private String filePath;

    @TableField
    @ApiModelProperty("文件名称")
    @NotEmpty(message = "文件名称不为空")
    @Length(min = 1,max = 50)
    private String fileName;

    @TableField
    @ApiModelProperty("文件类型")
    @NotEmpty(message = "文件类型不为空")
    @Length(min = 1,max = 50)
    private String fileType;


    @TableField
    @ApiModelProperty("文件大小")
    @NotEmpty(message = "文件大小不为空")
    @Length(min = 1,max = 20)
    private BigDecimal fileSize;

    @TableField
    @ApiModelProperty("文件大小单位")
    @NotEmpty(message = "文件大小单位不为空")
    @Length(min = 1,max = 20)
    private String fileSizeUom;

    @TableField(value = "is_enabled")
    @ApiModelProperty("文件是否启用")
    @NotEmpty(message = "文件启用标志不为空")
    private Long enabled;
}
